import { baseRequestClient, requestClient } from '#/api/request';

// 查询审批人的初始数据
export async function selectCommonId() {
  return requestClient.get(`/ChargeSystem/selectCommonId`);
}
// 查询审批人根据id查询数据
export async function selectCommon(id) {
  return requestClient.get(`/ChargeSystem/selectCommon?id=${id}`);
}
// 查公司/person/companyTree
export async function personCompanyTree() {
  return baseRequestClient.post(`ChargeSystem/person/companyTree`);
}
// 点击公司最后一层查小区 /getVillageByComId
export async function getVillageByComId(data: any) {
  return baseRequestClient.get(
    `ChargeSystem/SFGL/getVillageByComId?id=${data}`,
  );
}
// 审批同意ts类型
interface ApproveAgreeParams {
  approvalId: number;
  operateObject: number;
  operateType: string;
  operateContent: string;
  approvalOpinion: string;
}
// 审批拒绝ts类型
interface ApproveRefuseParams {
  approvalId: number;
  approvalOpinion: string;
}

// 应收计划审批-----------------------------------
// getExamineList
// applyForTimeStart 申请时间,applyForTimeEnd 申请结束时间,examinePersonTimeStart 审批开始时间,examinePersonTimeEnd 审批结束时间,examinePersonId 审批人员id,examineStatus 审批状态 0审批中 1同意 2拒绝
//  // 如果没有选择的话不传值，如果选择了就传值
export async function getExamineList(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/plan/getExamineList?applyForTimeStart=${data.applyForTimeStart}&applyForTimeEnd=${data.applyForTimeEnd}&examinePersonTimeStart=${data.examinePersonTimeStart}&examinePersonTimeEnd=${data.examinePersonTimeEnd}&examinePersonId=${data.examinePersonId}&examineStatus=${data.examineStatus}&page=${data.page}&limit=${data.limit}`,
  );
}
// 审批弹框 agreeInsertExamine  === '新增'
export async function agreeInsertExamine(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/plan/agreeInsertExamine?foreignKey=${data.foreignKey}&id=${data.id}&examineOpinion=${data.examineOpinion}&examineStatus=${data.examineStatus}`,
  );
}

// 审批弹框 agreeInsertExamine  === '修改'
export async function agreeUpdateExamine(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/plan/agreeUpdateExamine?foreignKey=${data.foreignKey}&id=${data.id}&examineOpinion=${data.examineOpinion}&examineStatus=${data.examineStatus}`,
  );
}

// 审批弹框 agreeInsertExamine  === '删除'
export async function agreeDeleteExamine(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/plan/agreeDeleteExamine?foreignKey=${data.foreignKey}&id=${data.id}&examineOpinion=${data.examineOpinion}&examineStatus=${data.examineStatus}`,
  );
}
// 应收计划导入审批------------------------------------------------------
// 获取表格    ChargeSystem/file/getFileExamineList
export async function getFileExamineList(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/file/getFileExamineList?startTime=${data.startTime}&endTime=${data.endTime}&examineStartTime=${data.examineStartTime}&examineEndTime,=${data.examineEndTime}&examinePersonId=${data.examinePersonId}&status=${data.status}&page=${data.page}&limit=${data.limit}`,
  );
}
// 同意审批submitFileExamine
export async function submitFileExamine(data: any) {
  return baseRequestClient.get(
    `/ChargeSystem/file/submitFileExamine?submitStatus=${data.submitStatus}&examineContent=${data.examineContent}&fileUrl=${data.fileUrl}&id=${data.id}`,
  );
}

// 删除审批下拉选------------------------------------------------------
// 删除审批查询
export async function getDeleteApprovePage(data) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/getDeleteApprovePage?applicationTime=${data.applicationTime}&approvalTime=${data.approvalTime}&approver=${data.approver}&approvalStatus=${data.approvalStatus}&page=${data.page}&limit=${data.limit}`,
  );
}
// 审批同意
export async function deleteApproveAgree(data: ApproveAgreeParams) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/deleteApproveAgree?approvalId=${data.approvalId}&operateObject=${data.operateObject}&approvalOpinion=${data.approvalOpinion}&operateType=${data.operateType}`,
  );
}
// 拒绝
export async function deleteApproveRefuse(data: ApproveRefuseParams) {
  console.log(data, '---');
  return baseRequestClient.get(
    `/ChargeSystem/approve/deleteApproveRefuse?approvalId=${data.approvalId}&approvalOpinion=${data.approvalOpinion}`,
  );
}

// 修改客户审批---------------------------------------------------------------------------
// 修改审批查询
export async function getUpdateApprovePage(data) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/getUpdateApprovePage?page=${data.page}&limit=${data.limit}&applicationTime=${data.applicationTime}&approvalTime=${data.approvalTime}&approver=${data.approver}&approvalStatus=${data.approvalStatus}`,
  );
}
// 修改审批同意  importType=热源/换热站/小区/房屋/面积
export async function updateApproveAgree(data: ApproveAgreeParams) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/updateApproveAgree?approvalId=${data.approvalId}&operateObject=${data.operateObject}&operateType=${data.operateType}&operateContent=${data.operateContent}&approvalOpinion=${data.approvalOpinion}`,
  );
}
//修改审批拒绝
export async function updateApproveRefuse(data: ApproveRefuseParams) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/updateApproveRefuse?approvalId=${data.approvalId}&approvalOpinion=${data.approvalOpinion}`,
  );
}

// 导入审批----------------------------------------------------------------------------------
// 导入审批查询
export async function getImportApprovePage(data) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/getImportApprovePage?applicationTime=${data.applicationTime}&approvalTime=${data.approvalTime}&approver=${data.approver}&approvalStatus=${data.approvalStatus}&page=${data.page}&limit=${data.limit}`,
  );
}
// 导入审批同意
export async function importApproveAgree(data: ApproveAgreeParams) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/importApproveAgree?approvalId=${data.approvalId}&fileNumber=${data.fileNumber}&fileLocation=${data.fileLocation}&importType=${data.importType}&applicantName=${data.applicantName}&approvalOpinion=${data.approvalOpinion}`,
  );
}
// 导入审批拒绝
export async function importApproveRefuse(data: ApproveAgreeParams) {
  return baseRequestClient.get(
    `/ChargeSystem/approve/importApproveRefuse?approvalId=${data.approvalId}&approvalOpinion=${data.approvalOpinion}`,
  );
}
// 红冲审批------------------------------------------------------------------------
// 红冲审批查询/getRedFlushApprovaldList
export async function getRedFlushApprovaldList(data: any) {
  return requestClient.post(`ChargeSystem/SFGL/getRedFlushApprovaldList`, data);
}
// 同意/拒绝红冲审批
// RedFlushApprovaldOperation
export async function RedFlushApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/RedFlushApprovaldOperation`,
    data,
  );
}
// 应收删除审批------------------------------------------------------------------------
// 应收删除审批查询getdelHeatFeeApprovaldList
export async function getdelHeatFeeApprovaldList(data: any) {
  return requestClient.post(
    `ChargeSystem/SFGL/getdelHeatFeeApprovaldList`,
    data,
  );
}

// 同意/拒绝应收删除审批
// delHeatFeeApprovaldOperation
export async function delHeatFeeApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/delHeatFeeApprovaldOperation`,
    data,
  );
}

// 查看详情  getdelHeatFeeApprovaldDetail
export async function getdelHeatFeeApprovaldDetail(data: any) {
  return requestClient.post(
    `ChargeSystem/SFGL/getdelHeatFeeApprovaldDetail`,
    data,
  );
}
// 收费标准审批------------------------------------------------------------------------
// 收费标准审批查询getJFBZApprovaldList
export async function getJFBZApprovaldList(data: any) {
  console.log(data, '---');
  return requestClient.post(`ChargeSystem/SFGL/getJFBZApprovaldList`, data);
}
// 同意/拒绝收费标准审批JFBZApprovaldOperation
export async function JFBZApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/JFBZApprovaldOperation`,
    data,
  );
}
// 分时段优惠
// getJFBZDiscountApprovaldInfo
export async function getJFBZDiscountApprovaldInfo(id: any) {
  return requestClient.get(
    `ChargeSystem/SFGL/getJFBZDiscountApprovaldInfo?id=${id}`,
  );
}
// 停供审批------------------------------------------------------------------------
// 停供审批查询 getStopApprovaldList
export async function getStopApprovaldList(data: any) {
  return requestClient.post(`ChargeSystem/SFGL/getStopApprovaldList`, data);
}
// 同意/拒绝停供审批  stopApprovaldOperation
export async function stopApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/stopApprovaldOperation`,
    data,
  );
}

// 开票审批------------------------------------------------------------------------
// 获取开票审批列表 getInvoiceApprovaldList
export async function getInvoiceApprovaldList(data: any) {
  return requestClient.post(`ChargeSystem/SFGL/getInvoiceApprovaldList`, data);
}
// 同意/拒绝开票审批  invoiceApprovaldOperation
export async function invoiceApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/invoiceApprovaldOperation`,
    data,
  );
}
// 收费导入审批------------------------------------------------------------------------
// 查询getImportFeeApprovaldList
export async function getImportFeeApprovaldList(data: any) {
  return requestClient.post(
    `ChargeSystem/SFGL/getImportFeeApprovaldList`,
    data,
  );
}
// 同意/拒绝收费导入审批  importFeeApprovaldOperation
export async function importFeeApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/importFeeApprovaldOperation`,
    data,
  );
}
// 删除审批---------------------------------------------------------------------------
// 查询getDelImportFeeApprovaldList
export async function getDelImportFeeApprovaldList(data: any) {
  return requestClient.post(
    `ChargeSystem/SFGL/getDelImportFeeApprovaldList`,
    data,
  );
}
// 同意/拒绝删除审批  importFeeApprovaldOperation
export async function delImportFeeApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/delImportFeeApprovaldOperation`,
    data,
  );
}
// 费用减免审批---------------------------------------------------------------------------
// 查询getDerateApprovaldList
export async function getDerateApprovaldList(data: any) {
  return requestClient.post(`ChargeSystem/SFGL/getDerateApprovaldList`, data);
}
// 同意/拒绝费用减免审批  derateApprovaldOperation
export async function derateApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/derateApprovaldOperation`,
    data,
  );
}
// 查看违约金减免   getDerateApprovaldById
export async function getDerateApprovaldById(id: any, type: any) {
  return requestClient.get(
    `ChargeSystem/SFGL/getDerateApprovaldById?id=${id}&type=${type}`,
  );
}
// 查看操作详情getDerateDetailApprovaldById
export async function getDerateDetailApprovaldById(id: any) {
  return requestClient.get(
    `ChargeSystem/SFGL/getDerateDetailApprovaldById?id=${id}`,
  );
}

// 退款审批  ---------------------------------------------------------------------------
// 查询  getRefundApprovaldList
export async function getRefundApprovaldList(data: any) {
  return requestClient.post(`ChargeSystem/SFGL/getRefundApprovaldList`, data);
}
// 同意/拒绝退款审批  refundApprovaldOperation
export async function refundApprovaldOperation(data: any) {
  return baseRequestClient.post(
    `ChargeSystem/SFGL/refundApprovaldOperation`,
    data,
  );
}
// 查看详情  getrefundApprovaldById
export async function getrefundApprovaldById(id: any) {
  return requestClient.get(`ChargeSystem/SFGL/getrefundApprovaldById?id=${id}`);
}
// 通知审批搜索
export async function getNoticeApprovaldList(data: any) {
  return baseRequestClient.get(
    `ChargeSystem/visible/getExamineList?applicationTimeBegin=${data.applicationTimeBegin}&applicationTimeEnd=${data.applicationTimeEnd}&applicantId=${data.applicantId}&approvalTimeBegin=${data.approvalTimeBegin}&approvalTimeEnd=${data.approvalTimeEnd}&approvalStatus=${data.approvalStatus}&page=${data.page}&limit=${data.limit}`,
    data,
  );
}
// 通知审批操作
export async function noticeApprovaldOperation(data: any) {
  return baseRequestClient.get(
    `ChargeSystem/visible/agreeExamine?id=${data.id}&examineType=${data.examineType}&foreignKey=${data.foreignKey}&examineOpinion=${data.examineOpinion}&examineStatus=${data.examineStatus}`,
  );
}
